package com.xcroot.chapter03;

/**
 * Created by CRoot on 2017/9/20.
 */

/*
<世界卫生组织推荐的计算方法：
<男性：(身高cm－80)×70﹪=标准体重女性：(身高cm－70)×60﹪=标准体重
<标准体重正负10﹪为正常体重标准体重正负10﹪~20﹪为体重过重或过轻
<标准体重正负20﹪以上为肥胖或体重不足
<超重计算公式
<超重%={（实际体重－理想体重）/（理想体重）}×100%
 */

class Human {
    private String name;
    private int age;
    private double height;
    private double weight;

    public Human(String name, int age, double height, double weight) {
        this.name = name;
        this.age = age;
        this.height = height;
        this.weight = weight;
    }

    public boolean isNormalHeight() {
        double NormalHeightStart = this.height - 80 - (this.height - 80) * 0.7 * 0.1;//按男性计算
        double NormalHeightEnd = this.height - 80 + (this.height - 80) * 0.7 * 0.1;//按男性计算
        if (this.weight >= NormalHeightStart && this.weight <= NormalHeightEnd)
            return true;
        else
            return false;
    }

    /**
     *
     * @return
     */
    public boolean isFat() {
        double FatHeightLine = this.height - 80 + (this.height - 80) * 0.7 * 0.2; //按男性计算
        if (this.weight >= FatHeightLine)
            return true;
        else
            return false;
    }
}
